﻿using System.Text;

namespace TPXSDK.NET.Mission;

/// <summary>
/// 分词器抽象类，用于对词元进行处理，每个指令均由此继承
/// </summary>
internal abstract class Tokenizer
{
    /// <summary>
    /// 词元正向处理函数,分析并生成FlyCmdItem
    /// </summary>
    public abstract bool Process();

    /// <summary>
    /// 指令逆向处理成Fly源码
    /// </summary>
    public abstract void Reverse(FlyCmdItem cmd, StringBuilder sb);

    /// <summary>
    /// 词源名称
    /// </summary>
    public string KeyName { get; protected set; } = string.Empty;

    /// <summary>
    /// 词源变量
    /// </summary>
    public int KeyValue { get; protected set; }

    /// <summary>
    /// 使用方法提示
    /// </summary>
    public string Usage { get; protected set; } = string.Empty;

    /// <summary>
    /// 指令描述
    /// </summary>
    public string Description { get; protected set; } = string.Empty;

    /// <summary>
    /// 是否为伪指令，用于指令修饰，不单独生成对应FlycmdItem
    /// </summary>
    public bool IsPseudo { get; protected set; }

    /// <summary>
    /// 所隶属管理器
    /// </summary>
    public TokenizerAdmin? Admin { get; protected set; }
}
